import request from "@/utils/request";

// 获取轮播图列表
const getSwiperList = (query) => {
  return request({
    url: "/website/banner/list",
    method: "get",
    params: query,
  });
};

// 上传阿里云
const postToOss = (file) => {
  return request({
    url: "/website/oss",
    method: "post",
    data: file,
  });
};

const addSwiper = (query) => {
  return request({
    url: "/website/banner",
    method: "post",
    data: query,
  });
};

// 修改轮播图
const updateSwiper = (query) => {
  return request({
    url: "/website/banner",
    method: "put",
    data: query,
  });
};

// 删除轮播图
const deleteSwiper = (id) => {
  return request({
    url: `/website/banner/${id}`,
    method: "delete",
  });
};

export { getSwiperList, postToOss, addSwiper, updateSwiper, deleteSwiper };
